package cn.cljh.day8_9.classCase._4Date;

import java.util.Calendar;

public class CalendaDemo {
    public static void main(String[] args) {
        Calendar calendar= Calendar.getInstance();
        System.out.println(calendar);
        System.out.println(calendar.get(Calendar.YEAR));//2022
        System.out.println(calendar.get(Calendar.MONTH)+1);//8
        System.out.println(calendar.get(Calendar.DAY_OF_MONTH));//9
        System.out.println(calendar.get(Calendar.HOUR));//9
        System.out.println(calendar.get(Calendar.MINUTE));//1
        System.out.println(calendar.get(Calendar.SECOND));//54
        System.out.println("===================");
        Calendar c2=Calendar.getInstance();
        System.out.println(c2);
        System.out.println("===================");
        c2.add(Calendar.DATE,10);
        System.out.println(c2.get(Calendar.YEAR));//2022
        System.out.println(c2.get(Calendar.MONTH)+1);//8
        System.out.println(c2.get(Calendar.DAY_OF_MONTH));//9
        System.out.println(c2.get(Calendar.HOUR_OF_DAY));//9
        System.out.println(c2.get(Calendar.MINUTE));//1
        System.out.println(c2.get(Calendar.SECOND));//54



    }

}
